package com.shixun.milktea.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

/**
 * @author Zourongsheng
 * @version 1.0
 * @date 2022/6/1 11:43
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tbl_manager")
@ApiModel(value="管理员对象", description="")
public class Manager implements UserDetails, Serializable {

    private static final long serialVersionUID = 1L;
    @TableId(value = "manager_id")
    @ApiModelProperty(value = "管理员编号")
    private String managerId;

    @ApiModelProperty(value = "管理员姓名")
    private String managerName;

    @ApiModelProperty(value = "管理员昵称")
    private String managerNickname;

    @ApiModelProperty(value = "管理员密码")
    private String managerPassword;

    @ApiModelProperty(value = "管理员电话")
    private String managerTelephone;

    @ApiModelProperty(value = "管理员角色;店长0；店员1")
    private String managerRole;




    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        
        return null;
    }

    /**
     * 获取用户密码
     * @return
     */
    @Override
    public String getPassword() {
        return  this.managerPassword;
    }

    /**
     * 获取用户名称
     * @return
     */
    @Override
    public String getUsername() {
        return this.managerNickname;
    }
    /**
     * 验证当前用户是否过期
     * 用户没有过期返回 true 过期返回false
     * @return
     */
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }
    /**
     * 当前用户是否锁定
     * 没有锁定返回true 锁定了返回false
     * @return
     */
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }
    /**
     * 密码是否过期
     * 没有过期返回 true 过期了返回false
     * @return
     */
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
    /**
     * 当前用户是否启用
     * 启用返回true 禁用返回false
     * @return
     */
    @Override
    public boolean isEnabled() {
        return true;
    }

}
